package com.xxxx.mytest.jihe.arraytest

/**
 * 数组
 */
object ArraysTest {

  def main(args: Array[String]): Unit = {

    /**
     * 数组
     */
    val array = Array(1,2,3)
    println(array(0))
    for (i <- array){
      println(i)
    }
    array.foreach(i=>println(i))
    array.foreach(println(_))
    array.foreach(println)
    array.foreach(i=>println(i+2))
    //二维数组
    val array1 = new Array[Array[Int]](4)
    array1(0) = Array(1,2)
    array1(1) = Array(3,2)
    array1(2) = Array(1,4)
    array1(3) = Array(2,2)
    array1.foreach(i=>{
      i.foreach(println)
      println("--------------")
    })

  }

}
